<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/_setor.xhtml">
	<ui:define name="corpo">

		<div id="conteudo">
			<h:form id="form">

				<h2>
					<h:outputText value="Editar Setor" />
				</h2>

				<p:messages id="msg" />

				<p:fieldset>
					<br />					

						<h:outputLink value="javascript:void(0)"
							onclick="dlgSetor.show();">
							<h:outputLabel value="Pesquisar Setor: " />
						</h:outputLink>
						<p:inputText id="setores" value="#{setorManagedBean.setor.nomeSetor}" onclick="dlgSetor.show();"
							readonly="true" rendered="true" onchange="handler">
						</p:inputText>
						<br />

					<p:commandButton id="button" value="Editar" ajax="false">
						<f:setPropertyActionListener target="#{setorManagedBean.setor}"
							value="#{setor}" />
						<f:ajax render="@all" />
					</p:commandButton>

				</p:fieldset>
				
				<p:fieldset legend="Dados do Setor">		

						<h:outputLabel value="Setor: " for="setor" />
						<p:inputText id="setor" value="#{setorManagedBean.setor.nomeSetor}" >
							<f:ajax event="change" />
						</p:inputText>

						<br />
				</p:fieldset>

			</h:form>

			<p:dialog header="Orgãos" widgetVar="dlgSetor" modal="true"
				width="400" showEffect="hide" resizable="false">
				<h:form id="form1">

					<p:outputPanel id="setores">
						<p:dataTable value="#{setorManagedBean.setores}" var="setor"
							paginator="true" rows="8" selectionMode="single">

							<p:column filterBy="#{setor.nomeSetor}" filterMatchMode="contains"
								sortBy="#{setor.nomeSetor}" headerText="Setores Cadastrados">
								<p:commandLink value="#{setor.nomeSetor}" onclick="dlgSetor.hide()"
									id="setor">
									<f:setPropertyActionListener  target="#{setorManagedBean.setor}"
										value="#{setor}" />
								</p:commandLink>
							</p:column>

							
						</p:dataTable>
					</p:outputPanel>
				</h:form>
			</p:dialog>



		</div>

	</ui:define>
</ui:composition>

</html>
